import {createStore} from "vuex"

const store = createStore({
	state:{
		name:'陈春燕',
		userInfo:{
			name:'陈春燕',
			age:20
		}
	},
	mutations:{
		name(state,name){
			state.name =name
		},
		userInfo(state,userInfo){
			state.userInfo =userInfo
		}
	},
	actions:{
		changeName(store,name){
			store.commit('name',name)
		},
		changeuserInfo(store,userInfo){
			store.commit('userInfo',userInfo)
		}
	},
	getters:{
		userInfoNewAge(state){
			return state.userInfo.age*2
		}
	}
})
export default store